package com.yuntsg.ruiijn.paperana.test;

import cn.hutool.core.io.FileUtil;
import com.yuntsg.ruiijn.paperana.utils.SmallTool;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class ES统计 {
    public static void main(String[] args) {
        File[] ls = FileUtil.ls("E:\\estxt");
        List<String> tables = new ArrayList<>();
        for (File l : ls) {
            List<String> strings = FileUtil.readUtf8Lines(l);
            for (String string : strings) {
                if (string.contains("入库结束")) {
                    System.out.println(string);
                    String split = string.split(":table\\+")[1].replace("入库结束", "");
                    tables.add(split.trim());
                }
            }
        }
        SmallTool.printMess("目前入库表数量+" + tables.size());
        System.out.println(tables);

    }

    public static List<String> getFinishTables() {
        String path = "/home/gcr/estxtimportLog/";
        File[] ls = FileUtil.ls(path);
        List<String> tables = new ArrayList<>();
        for (File l : ls) {
            List<String> strings = FileUtil.readUtf8Lines(l);
            for (String string : strings) {
                if (string.contains("入库结束")) {
                    String split = string.split(":table\\+")[1].replace("入库结束", "");
                    tables.add(split);
                }
            }
        }
        SmallTool.printMess("目前入库表数量+" + tables.size());
//        System.out.println(tables);
        return tables;
    }
}
